package cn.tips.dmp.supports.jpa;

import cn.tips.dmp.supports.helper.SnowflakeIdHelper;
import org.hibernate.engine.spi.SharedSessionContractImplementor;

import java.io.Serializable;
import org.hibernate.id.IdentityGenerator;

/**
 * @author pkb
 */
public class SnowflakeIdGenerator extends IdentityGenerator {

    public void SnowflakeIdGenerator() {
    }

    @Override
    public Serializable generate(SharedSessionContractImplementor s, Object obj) {
        return SnowflakeIdHelper.get().nextId();
    }
}
